home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / PInterfaces / Serial.p < prev    next >
Encoding:
Text File  |  1995-07-06  |  4.0 KB  |  167 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        Serial.p
  3.  
  4.      Contains:    Serial port Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. }
  19.  
  20. {$IFC UNDEFINED UsingIncludes}
  21. {$SETC UsingIncludes := 0}
  22. {$ENDC}
  23.  
  24. {$IFC NOT UsingIncludes}
  25.  UNIT Serial;
  26.  INTERFACE
  27. {$ENDC}
  28.  
  29. {$IFC UNDEFINED __SERIAL__}
  30. {$SETC __SERIAL__ := 1}
  31.  
  32. {$I+}
  33. {$SETC SerialIncludes := UsingIncludes}
  34. {$SETC UsingIncludes := 1}
  35.  
  36.  
  37. {$IFC UNDEFINED __TYPES__}
  38. {$I Types.p}
  39. {$ENDC}
  40. {    ConditionalMacros.p                                            }
  41.  
  42. {$PUSH}
  43. {$ALIGN MAC68K}
  44. {$LibExport+}
  45.  
  46. CONST
  47.     baud300                        = 380;
  48.     baud600                        = 189;
  49.     baud1200                    = 94;
  50.     baud1800                    = 62;
  51.     baud2400                    = 46;
  52.     baud3600                    = 30;
  53.     baud4800                    = 22;
  54.     baud7200                    = 14;
  55.     baud9600                    = 10;
  56.     baud19200                    = 4;
  57.     baud38400                    = 1;
  58.     baud57600                    = 0;
  59.     stop10                        = 16384;
  60.     stop15                        = -32768;
  61.     stop20                        = -16384;
  62.     noParity                    = 0;
  63.     oddParity                    = 4096;
  64.     evenParity                    = 12288;
  65.     data5                        = 0;
  66.     data6                        = 2048;
  67.     data7                        = 1024;
  68.     data8                        = 3072;
  69.  
  70.     ctsEvent                    = 32;
  71.     breakEvent                    = 128;
  72.     xOffWasSent                    = 128;
  73.     dtrNegated                    = 64;
  74.     ainRefNum                    = -6;                            {serial port A input}
  75.     aoutRefNum                    = -7;                            {serial port A output}
  76.     binRefNum                    = -8;                            {serial port B input}
  77.     boutRefNum                    = -9;                            {serial port B output}
  78.     swOverrunErr                = 1;                            {serial driver error masks}
  79.     breakErr                    = 8;                            {serial driver error masks}
  80.     parityErr                    = 16;                            {serial driver error masks}
  81.     hwOverrunErr                = 32;                            {serial driver error masks}
  82.     framingErr                    = 64;                            {serial driver error masks}
  83.     serdOptionClockExternal        = $40;                            {option bit used with Control code 16}
  84.     serdOptionPreserveDTR        = $80;                            {option bit used with Control code 16}
  85.  
  86.     sPortA                        = 0;
  87.     sPortB                        = 1;
  88.  
  89.     
  90. TYPE
  91.     SPortSel = SInt8;
  92.  
  93. { csCodes for serial driver Control routines }
  94.  
  95. CONST
  96.     serdReset                    = 8;
  97.     serdSetBuf                    = 9;
  98.     serdHShake                    = 10;
  99.     serdClrBrk                    = 11;
  100.     serdSetBrk                    = 12;
  101.     serdSetBaud                    = 13;
  102.     serdHShakeDTR                = 14;
  103.     serdSetMIDI                    = 15;
  104.     serdSetMisc                    = 16;
  105.     serdSetDTR                    = 17;
  106.     serdClrDTR                    = 18;
  107.     serdSetPEChar                = 19;
  108.     serdSetPECharAlternate        = 20;
  109.     serdSetXOff                    = 21;
  110.     serdClrXOff                    = 22;
  111.     serdSendXOnConditional        = 23;
  112.     serdSendXOn                    = 24;
  113.     serdSendXOffConditional        = 25;
  114.     serdSendXOff                = 26;
  115.     serdChannelReset            = 27;
  116.     serdSet230KBaud                = 'JF';                            { set 230K baud data rate }
  117.     serdSetPollWrite            = 'jf';                            { disable interrupt-driven transmit }
  118.     serdSetFlushCount            = 'FC';
  119.  
  120. { csCodes for serial driver Status routines }
  121.     serdGetBuf                    = 2;
  122.     serdStatus                    = 8;
  123.     serdGetVers                    = 9;
  124.     serdGetVersSys                = $8000;
  125.  
  126.  
  127. TYPE
  128.     SerShk = PACKED RECORD
  129.         fXOn:                    Byte;                                    {XOn flow control enabled flag}
  130.         fCTS:                    Byte;                                    {CTS flow control enabled flag}
  131.         xOn:                    CHAR;                                    {XOn character}
  132.         xOff:                    CHAR;                                    {XOff character}
  133.         errs:                    Byte;                                    {errors mask bits}
  134.         evts:                    Byte;                                    {event enable mask bits}
  135.         fInX:                    Byte;                                    {Input flow control enabled flag}
  136.         fDTR:                    Byte;                                    {DTR input flow control flag}
  137.     END;
  138.  
  139.     SerStaRec = PACKED RECORD
  140.         cumErrs:                Byte;
  141.         xOffSent:                Byte;
  142.         rdPend:                    Byte;
  143.         wrPend:                    Byte;
  144.         ctsHold:                Byte;
  145.         xOffHold:                Byte;
  146.     END;
  147.  
  148.  
  149. FUNCTION SerReset(refNum: INTEGER; serConfig: INTEGER): OSErr;
  150. FUNCTION SerSetBuf(refNum: INTEGER; serBPtr: Ptr; serBLen: INTEGER): OSErr;
  151. FUNCTION SerHShake(refNum: INTEGER; {CONST}VAR flags: SerShk): OSErr;
  152. FUNCTION SerSetBrk(refNum: INTEGER): OSErr;
  153. FUNCTION SerClrBrk(refNum: INTEGER): OSErr;
  154. FUNCTION SerGetBuf(refNum: INTEGER; VAR count: LONGINT): OSErr;
  155. FUNCTION SerStatus(refNum: INTEGER; VAR serSta: SerStaRec): OSErr;
  156.  
  157. {$ALIGN RESET}
  158. {$POP}
  159.  
  160. {$SETC UsingIncludes := SerialIncludes}
  161.  
  162. {$ENDC} {__SERIAL__}
  163.  
  164. {$IFC NOT UsingIncludes}
  165.  END.
  166. {$ENDC}
  167.